package com.huizu.project.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.huizu.common.annotation.Log;
import com.huizu.common.core.controller.BaseController;
import com.huizu.common.core.domain.AjaxResult;
import com.huizu.common.enums.BusinessType;
import com.huizu.project.domain.ProLd11;
import com.huizu.project.service.IProLd11Service;
import com.huizu.common.utils.poi.ExcelUtil;
import com.huizu.common.core.page.TableDataInfo;

/**
 * 劳动周报告Controller
 * 
 * @author zhangmx
 * @date 2024-05-10
 */
@RestController
@RequestMapping("/project/prold11")
public class ProLd11Controller extends BaseController
{
    @Autowired
    private IProLd11Service proLd11Service;

    /**
     * 查询劳动周报告列表
     */
    @PreAuthorize("@ss.hasPermi('project:prold11:list')")
    @GetMapping("/list")
    public TableDataInfo list(ProLd11 proLd11)
    {
        startPage();
        List<ProLd11> list = proLd11Service.selectProLd11List(proLd11);
        return getDataTable(list);
    }

    /**
     * 导出劳动周报告列表
     */
    @PreAuthorize("@ss.hasPermi('project:prold11:export')")
    @Log(title = "劳动周报告", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ProLd11 proLd11)
    {
        List<ProLd11> list = proLd11Service.selectProLd11List(proLd11);
        ExcelUtil<ProLd11> util = new ExcelUtil<ProLd11>(ProLd11.class);
        util.exportExcel(response, list, "劳动周报告数据");
    }

    /**
     * 获取劳动周报告详细信息
     */
    @PreAuthorize("@ss.hasPermi('project:prold11:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(proLd11Service.selectProLd11ById(id));
    }

    /**
     * 新增劳动周报告
     */
    @PreAuthorize("@ss.hasPermi('project:prold11:add')")
    @Log(title = "劳动周报告", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ProLd11 proLd11)
    {
        return toAjax(proLd11Service.insertProLd11(proLd11));
    }

    /**
     * 修改劳动周报告
     */
    @PreAuthorize("@ss.hasPermi('project:prold11:edit')")
    @Log(title = "劳动周报告", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ProLd11 proLd11)
    {
        return toAjax(proLd11Service.updateProLd11(proLd11));
    }

    /**
     * 删除劳动周报告
     */
    @PreAuthorize("@ss.hasPermi('project:prold11:remove')")
    @Log(title = "劳动周报告", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(proLd11Service.deleteProLd11ByIds(ids));
    }
}
